package com.nanhai.buddhist.college.module.collegebase.controller.teacher.teacher;

import com.nanhai.buddhist.college.framework.common.pojo.CommonResult;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.teacherteachers.vo.TeacherTeachersRespVO;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.teacherteachers.vo.TeacherTeachersUpdateReqVO;
import com.nanhai.buddhist.college.module.collegebase.convert.teacherteachers.TeacherTeachersConvert;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.teacherteachers.TeacherTeachersDO;
import com.nanhai.buddhist.college.module.collegebase.service.teacherteachers.TeacherTeachersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.nanhai.buddhist.college.framework.common.pojo.CommonResult.success;

/**
 * @author AKai
 * @date 2022/8/28
 */
@Api(tags = "移动端 - 教师管理 - 认证")
@RestController
@RequestMapping("/collegebase/teacher-teachers/move")
@Validated
public class TeacherAuthMoveController {


    @Resource
    private TeacherTeachersService teacherTeachersService;

/*
    @PostMapping("/login")
    @PermitAll
    @ApiOperation("使用账号密码登录")
    @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
    public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
        return success(teacherAuthService.login(reqVO));
    }*/

    @PostMapping("/update")
    @ApiOperation("修改个人信息")
    public CommonResult<Boolean> updateTeacherTeachers(@Valid @RequestBody TeacherTeachersUpdateReqVO updateReqVO) {
        teacherTeachersService.updateTeacherTeachers(updateReqVO);
        return success(true);
    }



    @GetMapping("/get")
    @ApiOperation("查看个人信息")
    @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = String.class)
    public CommonResult<TeacherTeachersRespVO> getTeacherTeachers(@RequestParam("id") String id) {
        TeacherTeachersDO teacherTeachers = teacherTeachersService.getTeacherTeachers(id);
        return success(TeacherTeachersConvert.INSTANCE.convert(teacherTeachers));
    }

}
